<template>
	<view class="p-t-20" :class="themeName">
		<view class="serve-nav flex flex-wrap">
			<view class="nav-item flex-col col-center" v-for="(item, index) in lists" :key="index" @click="goto(item.title)">
				<u-image width="60rpx" height="60rpx" :src="item.icon" />
				<view class="xs m-t-12 black md">{{ item.title }}</view>
				<view><text style="color: #0980CC;">{{item.num}}</text>
					<text v-if="item.title=='订单总数'">单</text>
					<text v-else>元</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import { sytj } from '@/api/others';
export default {
	data() {
		return {
			lists:[
				{title:'订单总数',num:0,icon:'/others/static/a15.png'},
				{title:'订单总金额',num:0,icon:'/others/static/a16.png'},
				{title:'分佣总金额',num:0,icon:'/others/static/a17.png'},
				{title:'门店总收益',num:0,icon:'/others/static/a19.png'},
			]
		};
	},
	async onLoad() {
		await this.getInfo();
	},
	methods: {
		getInfo(){
			sytj().then(res => {
				this.lists[0].num = res.order_count;
				this.lists[1].num = res.order_price;
				this.lists[2].num = res.fenyong_price;
				this.lists[3].num = res.mendian_price;
			});
		},
		goto(title){
			if(title=='门店总收益'){
				uni.navigateTo({
					url:'/others/pages/dealer/mymdsy'
				})
			}
		}
	}
};
</script>

<style lang="scss" scoped>
.serve-nav {
	padding:30rpx 0;
	background-color: #fff;
	margin:0 20rpx;
	.nav-item {
		width: 50%;
		margin: 30rpx 0;
	}
}
</style>
